package JAVA300.第九章容器;

import java.util.HashMap;
import java.util.Map;

/**
 * 测试map常用方法
 */

public class TestMap2 {
    public static void main(String[] args) {
        Employee e1 = new Employee(1001,"hqq",23000);
        Employee e2 = new Employee(1002,"qyh",30000);
        Employee e3 = new Employee(1003,"jsbdaj",2000);

        Map<Integer,Employee> map = new HashMap<>();
        map.put(1001,e1);
        map.put(1002,e2);
        map.put(1003,e3);

        Employee employee = map.get(1001);
        System.out.println(employee.getEname());

        System.out.println(employee);


    }
}

class Employee{
    private int ID;
    private String ename;
    private double salary;

    public Employee(int ID, String ename, double salary) {
        super();
        this.ID = ID;
        this.ename = ename;
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "id:"+ID +" ;ename:"+ ename +" ;salary:"+salary;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
}